package src.Packets;

import src.Util.Stream;
import src.Players.*;
import src.Main;

public class ActionButtons
{
    public ActionButtons(Player p)
    {
        if(p == null || p.inStream == null)
        {
            return;
        }
        int buttonId = p.inStream.readUnsignedWord();
        switch(buttonId)
        {
            case 153: //Start running.
                p.isRunning = true;
            break;
            case 152: //Stop running.
                p.isRunning = false;
            break;
            case 168: //Yes emote.
                p.requestAnim(855, 5);
            break;
            case 169: //No emote.
                p.requestAnim(856, 5);
            break;
            case 162: //Think emote.
                p.requestAnim(857, 5);
            break;
            case 164: //Bow emote.
                p.requestAnim(858, 5);
            break;
            case 165: //Angry emote.
                p.requestAnim(859, 5);
            break;
            case 161: //Cry emote.
                p.requestAnim(860, 5);
            break;
            case 170: //Laugh emote.
                p.requestAnim(861, 5);
            break;
            case 171: //Cheer emote.
                p.requestAnim(862, 5);
            break;
            case 163: //Wave emote.
                p.requestAnim(863, 5);
            break;
            case 167: //Beckon emote.
                p.requestAnim(864, 5);
            break;
            case 172: //Clap emote.
                p.requestAnim(865, 5);
            break;
            case 166: //Dance emote.
                p.requestAnim(866, 5);
            break;
            case 13362: //Panic emote.
                p.requestAnim(2105, 5);
            break;
            case 13363: //Jig emote.
                p.requestAnim(2106, 5);
            break;
            case 13364: //Spin emote.
                p.requestAnim(2107, 5);
            break;
            case 13365: //Head bang emote.
                p.requestAnim(2108, 5);
            break;
            case 13366: //Joy jump emote.
                p.requestAnim(2109, 5);
            break;
            case 13367: //Rasp' berry emote.
                p.requestAnim(2110, 5);
            break;
            case 13368: //Yawn emote.
                p.requestAnim(2111, 5);
            break;
            case 13369: //Salute emote.
                p.requestAnim(2112, 5);
            break;
            case 13370: //Shrug emote.
                p.requestAnim(2113, 5);
            break;
            case 2458: //logout.
                Main.m.ge.frame.logout(p);
            break;
            case 5387: //Do not withdraw bank item as note.
                p.takeAsNote = false;
            break;
            case 5386: //Withdraw bank item as note.
                p.takeAsNote = true;
            break;
            case 2282:
            case 4454:
            case 5576:
            case 2429:
            case 1704:
            case 1772:
            case 336:
            case 5860:
            case 12298:
            case 7768:
            case 443:
            case 4711:
            case 1757:
            case 433:
            case 3802:
                p.skillId = 0; //Accurate style.
            break;
            case 2283:
            case 4452:
            case 8467:
            case 5577:
            case 2430:
            case 1705:
            case 334:
            case 5861:
            case 12296:
            case 7769:
            case 431:
            case 4712:
            case 1755:
            case 3803:
            case 4686:
                p.skillId = 1; //Defensive style.
            break;
            case 2284:
            case 2285:
            case 4453:
            case 8468:
            case 5579:
            case 5578:
            case 2432:
            case 1707:
            case 1706:
            case 1771:
            case 335:
            case 5862:
            case 7771:
            case 432:
            case 4714:
            case 4713:
            case 1756:
            case 3805:
                p.skillId = 2; //Aggresive style.
            break;
            case 8466:
            case 2431:
            case 1770:
            case 12297:
            case 7770:
            case 3804:
            case 4685:
            case 4688:
            case 4687:
                p.skillId = 3; //Controlled style.
            break;
	    case 3420:
		PlayerTrade pt = new PlayerTrade(p);
		pt.acceptFirstScreen(p);
		pt = null;
	    break;
	    case 3546:
		PlayerTrade pt2 = new PlayerTrade(p);
		pt2.acceptSecondScreen(p);
		pt2 = null;
	    break;
	    case 6674:
		PlayerDuel pd = new PlayerDuel(p);
		pd.acceptFirstScreen(p);
		pd = null;
	    break;
	    case 6520:
		PlayerDuel pd2 = new PlayerDuel(p);
		pd2.acceptSecondScreen(p);
		pd2 = null;
	    break;
            default:
                Main.m.log("[" + p.playerIndex + "-" + p.username + "] Unhandled packet 185 button " + buttonId);
            break;
        }
    }
}